//- Copyright (c) 2016 Lucky Byte, Inc.
extends ../../table

block form_items
  .field.two.wide
    .ui.calendar.date#start_date(data-end-with="#end_date"
      data-maxdate="#{today()}")
      .ui.input.left.icon
        i.calendar.icon
        input(type="text" name="start_date" placeholder="起始日期"
          value="#{start_date || ''}")
  .field.two.wide
    .ui.calendar.date#end_date(data-start-with="#start_date"
      data-maxdate="#{today()}")
      .ui.input.right.icon
        input(type="text" name="end_date" placeholder="结束日期"
          value="#{end_date || ''}")
        i.remove.link.icon#date_clear

  .field.two.wide
    .ui.input.left.icon
      i.yen.icon
      input.submit(type="text" name="min_amt" placeholder="最低充值金额"
        value="#{min_amt || ''}")
  .field.two.wide
    .ui.input.left.icon
      i.yen.icon
      input.submit(type="text" name="max_amt" placeholder="最高充值金额"
        value="#{max_amt || ''}")

  .field.five.wide
    .ui.buttons.right.floated
      button#new.ui.green.left.icon.labeled.button(type="submit") 查 询
        i.icon.search
      button#new.ui.blue.button(type="button"
        onclick="window.location = '/p2/fund'") 返回资金池管理

block thead
  tr
    th.center.aligned(rowspan="2")
    th.center.aligned(rowspan="2") 序号
    th.center.aligned(rowspan="2") 充值时间
    th.center.aligned(rowspan="2") 充值金额
    th.center.aligned(colspan="2") 充值前
    th.center.aligned(colspan="2") 充值后
    th.center.aligned(rowspan="2") 充值用户
    th.center.aligned(rowspan="2") 资金池代号
    th.center.aligned(rowspan="2") 代理商名称
    th.center.aligned(rowspan="2") 联系人
  tr
    th.center.aligned 总 额
    th.center.aligned 余 额
    th.center.aligned 总 额
    th.center.aligned 余 额

block tbody
  each record, index in records
    - var lessthan0 = false
    if parseFloat(record.amt) < 0
      - lessthan0 = true
    tr(class="#{lessthan0 ? 'warning' : ''}")
      td.center.aligned.collapsing
        if lessthan0
          i.icon.minus.red
        else
          i.icon.plus.green

      td.center.aligned.collapsing= index + 1
      td.center.aligned.collapsing= record.time
      td.center.aligned= fmtamt(record.amt)
      td.center.aligned= fmtamt(record.total)
      td.center.aligned= fmtamt(record.remains)
      td.center.aligned
        = fmtamt(parseFloat(record.amt) + parseFloat(record.total))
      td.center.aligned
        = fmtamt(parseFloat(record.amt) + parseFloat(record.remains))
      td.center.aligned.collapsing= record.user
      td.center.aligned.collapsing= record.name
      td.center.aligned= record.agent
      td.center.aligned.collapsing= record.contact
  else
    td.center.aligned.warning(colspan="12") 无数据
